{% set clazz = "orders" %}
{% set title = "全部订单" %}
{% extends './modules/common/templates/main.html' %}
{% block style %}
  <link rel="stylesheet" type="text/css" href="{{ '/static/css/store.css'|version }}" />
{% endblock %}
{% block content %}
  {% if !nested %}
    <header class="bar bar-header">
      {{ macro.back() }}
      <h1 class="title">{{ title }}</h1>
    </header>
  {% endif %}
  <section>
    {% if !noNavbar  %}
      <div class="tabs compact">
        {% if isVendor %}
          <a class="item {% if !status %}active{% endif %}" href="/store/storeorders">全部</a>
          <a class="item {% if status %}active{% endif %}" href="/store/storeorders?status=1">待处理</a>
        {% else %}
          <a class="item {% if !status %}active{% endif %}" href="/store/orders">全部</a>
          <a class="item {% if status %}active{% endif %}" href="/store/orders?status=1">待处理</a>
        {% endif %}
      </div>
    {% endif %}
    <div id="orders" class="card hspace vspace">
      <input type="hidden" name="vendorId" value="{{vendorId}}">
      <input type="hidden" name="keyWord" value="{{keyWord}}">
      {% if list.length %}
        {% for item in list %}
          <div class="item round">
            <div class="header">
              <div class="text">
                <span>{{item.orderDelivery.receiveUserName}}</span>
                <span class="hspace">{{item.orderDelivery.receiveUserPhone}}</span>
                <span class="pull-right text-orange">{{ item.orderStatusName }}</span>
              </div>
            </div>
            <a class="content" href="/store/order/{{item.orderCode}}">
              {% for good in item.orderGoods %}
                <div class="avatar">
                  <img class="center-block" src="{{ good.skuImgUrl[0] }}" />
                </div>
              {% endfor %}
            </a>
            <div class="footer clearfix">
              价格:<span class="text-orange">{{ item.shouldPay|currency }}</span>
              {% if item.orderStatus == 1 || item.orderStatus == 2 %}
                <div class="buttons text-right">
                  <a class="button inline default little" href="/store/order/{{item.orderCode}}">处理</a>
                </div>
              {% endif %}
            </div>
          </div>
        {% endfor %}
      {% else %}
        <div class="plate">
          <div class="draw">
            <img src="http://7xjyap.com2.z0.glb.qiniucdn.com/image-2f0df3ff-2a9a-4367-a7df-bd53231b0a9f.png" alt="空白" />
            <h4 class="title">还没有相关订单</h4>
          </div>
        </div>
      {% endif %}
    </div>
  </section>
  {% raw %}
  <script id="ordersTempl" type="text/swig-template">
  {% for item in list %}
    <div class="item round">
      <div class="header">
        <div class="text">
          <span>{{ item.orderDelivery.receiveUserName }}</span>
          <span class="hspace">{{ item.orderDelivery.receiveUserPhone }}</span>
          <span class="pull-right text-orange">{{ item.orderStatusName }}</span>
        </div>
      </div>
      <a class="content" href="/store/order/{{item.orderCode}}">
        {% for good in item.orderGoods %}
          <div class="avatar">
            <img class="center-block" src="{{ good.skuImgUrl[0] }}" />
          </div>
        {% endfor %}
      </a>
      <div class="footer clearfix">
        价格:<span class="text-orange">{{ item.shouldPay|currency }}</span>
        <div class="buttons text-right">
          {% if item.orderStatus == 1 || item.orderStatus == 2 %}
            <a class="button inline default little" href="/store/order/{{item.orderCode}}">处理</a>
          {% endif %}
        </div>
      </div>
    </div>
  {% endfor %}
  </script>
{% endraw %}
{% endblock %}
{% block script %}
  {% parent %}
  <script src="{{ '/static/js/store.js'|version }}"></script>
{% endblock %}